<template>
	<view class="cont padd20">
		<view class="list padd20 box box-align-center mt20" v-for="(item,index) in Data" :key="index" @click="goDetail(item)">
			<u-image width="210rpx" height="152rpx" :src="item.display"></u-image>
			<view class="box box-tb box-align-start ml10">
				<view style="font-size: 32rpx;font-weight: bold;">
					{{item.title}}
				</view>
				<view class="mt20" style="font-size: 27rpx;color: #5F6572;">
					{{timeFommater(item.createtime)}}
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				Data: []
			}
		},
		onLoad() {
			this.getList()
		},
		methods: {
			timeFommater(value) {
				var dateee = new Date(value).toJSON();
				var date = new Date(+new Date(dateee) + 8 * 3600 * 1000).toISOString().replace(/T/g, ' ').replace(/\.[\d]{3}Z/, '')
				return date;
			},
			
			goDetail(item){
				uni.navigateTo({
					url:"/pageHome/newsDetail"
				})
				uni.setStorageSync('info',JSON.stringify(item))
			},
			getList(){
				let opts = {
					url: '/information/pagelist',
					method: 'post'
				};
				let params = {
					pageNum:1,
					pageSize:1000
				};
				this.$api.RPost(opts, params).then(res => {
					console.log(res);
					if(res.state.code == 0){
						this.Data = res.body.data.list
					}
					
				})
			}
		}
	}
</script>

<style scoped>
	.cont {
		box-sizing: border-box;
		width: 100%;
		height: 100%;
		background: #F6F9FF;
	}
	.list{
		width: 100%;
		height: 220rpx;
		background: #FFFFFF;
		box-shadow: 0rpx 9rpx 46rpx 0rpx rgba(187,205,223,0.14);
		border-radius: 26rpx;
	}
</style>
